package io.demo.message.util;

import io.demo.message.domain.City;
import java.util.function.Supplier;
import org.apache.commons.lang3.RandomUtils;

class RandomCitySupplier implements Supplier<City> {

  private RandomStringBuilder randomStringBuilder;

  RandomCitySupplier() {
    this.randomStringBuilder = RandomStringBuilder.newBuilder()
        .useUpperCase()
        .useLowerCase()
        .useWhitespace();
  }

  @Override
  public City get() {
    return City.builder()
        .id(RandomUtils.nextLong())
        .name(randomStringBuilder.build(10, 30))
        .adminLevel(TestingModels.adminLevel())
        .area(TestingModels.area())
        .build();
  }
}
